package org.nowcoder.huawei.c200;

public class HC023 {

    public static void main(String[] args) {
        System.out.println( ipToLong("2.2.2.2"));
        System.out.println( ipToLong("6.6.6.6"));
        System.out.println( ipToLong("3.3.3.3"));
        System.out.println( ipToLong("4.4.4.4"));

        System.out.println( ipToLong("5.5.5.5"));
    }

    public static long ipToLong(String ip) {
        String[] parts = ip.split("\\.");
        long result = 0;
        for (String part : parts) {
            result = result * 256 + Integer.parseInt(part);
        }
        return result;
    }
}

